package com.lx.algorithm.structure;

import com.lx.thread.MyThread.lx.MyThread;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-09-02 15:34:14
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-09-02     张李鑫                     1.0         1.0 Version
 */
public class Node {


    public static class MyNode {
        public int value;
        public MyNode last;
        public MyNode next;

        public MyNode() {
        }

        public MyNode(int value) {
            this.value = value;
        }
    }

    /**
     * <p>
     * 单链表反转
     * </p>
     *
     * @param myNode
     * @return com.lx.algorithm.structure.Node.MyNode
     * @Author zlx
     * @date 2021/9/2
     */
    public static MyNode reverseLinkedList(MyNode myNode) {
        if (myNode == null) {
            return null;
        }

        MyNode cur = null;
        MyNode next = null;
        while (myNode != null) {
            cur = myNode.next;
            myNode.next = next;
            next = myNode;
            myNode = cur;
        }
        return next;
    }

    /**
     * <p>
     * 删除某个数的所有节点
     * </p>
     *
     * @param head
     * @return com.lx.algorithm.structure.Node.MyNode
     * @Author zlx
     * @date 2021/9/2
     */
    public static MyNode delNode(MyNode head, int num) {
        MyNode pre = null;

        return pre;
    }


    public static void main(String[] args) {
        MyNode node = new MyNode(1);
        MyNode node1 = new MyNode(2);
        MyNode node2 = new MyNode(3);
        MyNode node3 = new MyNode(4);
        MyNode node4 = new MyNode(5);
        MyNode node5 = new MyNode(6);
        node.next=node1;
        node1.next=node2;
        node2.next=node3;
        node3.next=node4;
        node4.next=node5;


        MyNode myNode = reverseLinkedList(node);
        while (myNode!=null){
            System.out.println(myNode.value);
            myNode=myNode.next;
        }
    }
}
